<div id="report_stats" align="center">

<?php
	$a='';
	$b='';
	$c='';
	if (isset($_GET['c']))
	{
		$a=$_GET['c'];
	}
	if (isset($_GET['rango']))
	{
		$b=$_GET['rango'];
	}
	if (isset($_GET['lo']))
	{
		$c=$_GET['lo'];
	}
	$db = new Database;

?>
	<table width="800" align="center">
		<tr style="border:5px solid navy;">
			<th width="123" style="color:red;font-size:140%;border-bottom:1px solid #C0C2B8;text-align:left; width:28%;padding: 10px 0;">
				<?php echo Kohana::lang('ui_main.category');?>
				<a style="font-size:60%;" href="javascript:toggleLayer('kml_switch_link', 'kml_switch', '<?php echo Kohana::lang('ui_main.category');?>')" id="kml_switch_link">
					<?php echo Kohana::lang('ui_main.show'); ?>
				<a/>&nbsp;
			</th>
			<th width="468" style="color:red;font-size:140%;border-bottom:1px solid #C0C2B8;text-align:left; width:37.66%;">
				<?php echo ucfirst(Kohana::lang('ui_main.days'));?>
				<a style="font-size:60%;" href="javascript:toggleLayer('kml_switch_link2', 'kml_switch2', '<?php echo ucfirst(Kohana::lang('ui_main.days'));?>')" id="kml_switch_link2">
					<?php echo Kohana::lang('ui_main.show'); ?>
				</a>
			</th>
			<th width="214" style="color:red;font-size:140%;border-bottom:1px solid #C0C2B8;text-align:left; width:33.33%;">
				<?php echo Kohana::lang('ui_main.location');?>
				<a style="font-size:60%;" href="javascript:toggleLayer('kml_switch_link3', 'kml_switch3', '<?php echo Kohana::lang('ui_main.location');?>')" id="kml_switch_link3">
					<?php echo Kohana::lang('ui_main.show'); ?>
				</a>
				<a href="<?php echo url::site(); ?>reports/" style="padding-left:65px;">
					<?php //echo Kohana::lang('ui_main.clear_filter');?>
					<img src="<?php echo url::base()?>themes/default/images/refresh.gif" style="padding-left:105px;"/>
				</a>
			</th>
		</tr>
	</table> 
	<div>
		<div id="kml_switch" align="left" style="display:none;width:28%;float:left;">
			<table  border="0"  cellpadding="0" cellspacing="0">
				<?php
					echo $categories;
				?>
			</table>		
		</div>
		<div id="kml_switch2" valign="top" style="display:none;width:44%;align:center;padding-right:45px;">
			<div class="map_filter" style="margin-top:-2px;">
				<ul class="btn_filter">
					<li>
						<a id="1" href="<?php echo "?rango=1&&c=".$a."&&lo=".$c ?>" <?php if($b==1) echo 'class="active"' ;?> >
							<?php echo Kohana::lang('ui_main.one'); ?>
						</a>
					</li>
					<li>
						<a id="7" href="<?php echo "?rango=7&&c=".$a."&&lo=".$c ?>" <?php if($b==7) echo 'class="active"' ;?> >
							<?php echo Kohana::lang('ui_main.seven'); ?>
						</a>
					</li>
					<li>
						<a id="15" href="<?php echo "?rango=15&&c=".$a."&&lo=".$c ?>" <?php if($b==15) echo 'class="active"' ;?> >
							<?php echo Kohana::lang('ui_main.fifteen'); ?>
						</a>
					</li>
					<li>
						<a id="30" href="<? echo "?rango=30&&c=".$a."&&lo=".$c?>" <?php if($b==30) echo 'class="active"' ;?> >
							<?php echo Kohana::lang('ui_main.thirty'); ?>
						</a>
					</li>
			
				</ul>
			</div>
		</div>
		
		<div id="kml_switch3" valign="top" style="display:none;width:28%;float:right;valign:center;">
			<?php
			$query1 = "select county from location where county != '' group by county order by 1;";
			$query1 = $db->query($query1);
			?>
			<select name='Municipio' onchange="gotourl(this.value)" style="width:240px;">
				<?php
				if ($c == '')
				{
				?>
					<option value="<?php echo "?lo=".Kohana::lang('ui_main.metropolitan')."&&rango=".$b."&&c=".$a; ?>">
						<?php echo Kohana::lang('ui_main.metropolitan'); ?>
					</option>
				<?php
				}
				else
				{
				?>
					<option value="<? echo $c; ?>">
						<?php echo $c; ?>
					</option>
					<option value="<?php echo "?lo=".Kohana::lang('ui_main.metropolitan')."&&rango=".$b."&&c=".$a; ?>">
						<?php echo Kohana::lang('ui_main.metropolitan'); ?>
					</option>
				<?php
				}
				foreach ($query1 as $location)
				{ 
				?>
					<option value="<? echo "?lo=".$location->county."&&rango=".$b."&&c=".$a?>">
						<? echo $location->county; ?>
					</option>
				<?php
				}
				?>
			</select>
		</div>
	</div>
<SCRIPT language="JavaScript" type="text/javascript">  
	function gotourl(url)
	{  
		window.location= url;  
	}  
</SCRIPT>  

</div>